A class loader, such as a Java® class loader, dynamically loads classes into a virtual machine. Usually, these classes are only loaded on demand as discussed below.
A software library is a collection of related object code. In the Java® language, libraries are typically packaged in JAR (Java® ARchive) files. Libraries can contain objects of different types. The most important type of object contained in a JAR file is a Java® class. A class can be thought of as a named unit of code. The class loader is responsible for locating libraries, reading their contents, and loading the classes contained within the libraries. This loading is typically done “on demand,” in that it does not occur until the class is actually used by the program. A class with a given name can only be loaded once by a given class loader.
Unfortunately, problems may occur when the class loader loads the classes, such as class cast exceptions (indicates that the code has attempted to cast an object to a subclass of which it is not an instance), class not found exceptions (e.g., class is not visible on the logical classpath of the context class loader, the application incorrectly uses a class loader API, a dependent class is not visible), no class definition found exceptions (e.g., class is not in the logical class path, class cannot load), etc.
Currently, when a class loader problem occurs, traces, logs or memory dumps are analyzed to determine the causes of the class loader errors. However, such analysis occurs after the classes have been deployed to the production environment involving time consuming analysis to debug these problems, especially in large and complex product enterprise environments. If, however, potential class loader problems could be identified or detected prior to or during the deployment of the classes to the production environment, then class loader errors could be eliminated (e.g., eliminate a class cast exception error) thereby saving programmers time from no longer having to debug class loader problems.
Unfortunately, there is not currently a means for identifying or detecting potential class loader problems prior to or during the deployment of the classes to the production environment.